<template>
  <div class="app-container">
    <el-table
      :data="list"
      v-loading.body="listLoading"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="ID" width="95">
        <template slot-scope="scope">
          {{ scope.$index }}
        </template>
      </el-table-column>
      <el-table-column label="学生名称">
        <template slot-scope="scope">
          {{scope.row.student.name}}
        </template>
      </el-table-column>
      <el-table-column label="试题名称"  >
        <template slot-scope="scope">
          {{scope.row.paper.name}}
        </template>
      </el-table-column>
      <el-table-column label="答题时间"  >
        <template slot-scope="scope">
          {{scope.row.createtime}}
        </template>
      </el-table-column>
      <el-table-column label="所属班级"  >
        <template slot-scope="scope">
          {{scope.row.classroom.name}}
        </template>
      </el-table-column>
      <el-table-column label="出题教师"  >
        <template slot-scope="scope">
          {{scope.row.teacher.name}}
        </template>
      </el-table-column>
      <el-table-column label="获得分数/总分"  >
        <template slot-scope="scope">
          {{scope.row.score}} / {{scope.row.paper.totalscore}}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  import { getAllAnswerResultList,getAnswerList } from "@/api/admin";

  export default {
    data() {
      return {
        list: null,
        listLoading: true,
        listQuery:{
          currentpage:1,
          pagesize:20,
          name:"",
        }
      };
    },
    created() {
      this.fetchData();
    },
    methods: {
      fetchData() {
        this.listLoading = true;
        getAllAnswerResultList(this.listQuery).then((response) => {
          console.log("get list success")
          this.list = response.info;
          this.listLoading = false;
        }).catch(err=>{
          this.listLoading = false;
        })
      },
      disable:function(e){
        console.log(e);
      }
    },
  };
</script>
